const { createClient } = require('redis')

let redis = createClient({
    username: '',
    password: '',
    socket: {
        host: 'localhost',
        port: 6379,
    }
})

module.exports.connect = () => {
    return new Promise((resolve) => {
        redis.connect().then(() => {
            redis.set('token', 'tokenggfas1231212331').then(resolve)
        })
    })
}

module.exports.getToken = (key) => {
    return redis.get(key)
}